VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmToolAuditTrail 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Audit Trail"
   ClientHeight    =   7185
   ClientLeft      =   -60
   ClientTop       =   -105
   ClientWidth     =   12510
   Icon            =   "frmToolAuditTrail.frx":0000
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   7185
   ScaleWidth      =   12510
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.ListView lvwAudit 
      Height          =   6345
      Left            =   45
      TabIndex        =   0
      Top             =   45
      Width           =   11700
      _ExtentX        =   20638
      _ExtentY        =   11192
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      HotTracking     =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      NumItems        =   0
   End
End
Attribute VB_Name = "frmToolAuditTrail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables



Public sBit As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Enum eAuditList
    AllName
    UserName
    ModuleName
    DateRange
End Enum

Public mAuditList As eAuditList

Private lLoaded As Boolean


Private connList As ADODB.Connection



'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    
    CloseMenuTab ITGLedgerMain
    
    
    
    
    Set frmToolAuditTrail = Nothing
    
    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFind()
    '**********
End Sub

Public Sub TBFindPrimary()
    '**********
End Sub

Private Sub Form_Load()
    
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'ST01'")

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True
    
'    Height = 9800
'    Width = 11820
    
    lvwAudit.Height = Height - IIf(Height < 400, Height, 400)
    lvwAudit.Width = Width - 120
    
    LoadList
    lLoaded = True
End Sub



'Load transaction list for approval
Sub LoadList()
    lvwAudit.ListItems.Clear
    If rs.State = adStateOpen Then rs.Close

    Select Case mAuditList
        Case AllName

            Caption = "All Transactions"

            Set itmX = lvwAudit.ColumnHeaders.Add(, , "Module Name")
            Set itmX = lvwAudit.ColumnHeaders.Add(, , "Date")
            Set itmX = lvwAudit.ColumnHeaders.Add(, , "Transaction No")
            Set itmX = lvwAudit.ColumnHeaders.Add(, , "Event")
            Set itmX = lvwAudit.ColumnHeaders.Add(, , "User Name")
            Set itmX = lvwAudit.ColumnHeaders.Add(, , "Machine Name")
            lvwAudit.ColumnHeaders(1).Width = "1750"
            lvwAudit.ColumnHeaders(2).Width = "2000"
            lvwAudit.ColumnHeaders(3).Width = "1750"
            lvwAudit.ColumnHeaders(4).Width = "2400"
            lvwAudit.ColumnHeaders(5).Width = "1750"
            lvwAudit.ColumnHeaders(6).Width = "1750"

            sSQL = "SELECT cModule, dDate, cTranNo, cEvent, cUser, cMachine FROM LogFile ORDER BY dDate DESC"

            OpenNewConnection connList
            rs.Open sSQL, connList, adOpenKeyset

            Do Until rs.EOF
                Set itmX = lvwAudit.ListItems.Add(, , Trim(rs!cModule))
                    itmX.SubItems(1) = Format(rs!dDate, "MM/dd/yyyy   H:MM:SS")
                    itmX.SubItems(2) = Trim(rs!cTranNo)
                    itmX.SubItems(3) = Trim(rs!cEvent)
                    itmX.SubItems(4) = Trim(rs!cUser)
                    itmX.SubItems(5) = Trim(rs!cMachine)
                rs.MoveNext
            Loop

            Set rs = Nothing
            Set connList = Nothing

        Case ModuleName
        Case UserName
    End Select
End Sub


Private Sub lvwAudit_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub
